package jp.co.kayo.gae.takidashibot.controller.takidasibot;

import jp.co.kayo.gae.takidashibot.utils.Utils;

import org.slim3.controller.Navigation;
import org.slim3.util.RequestMap;

public class SearchController extends Search2Controller {
    
    public SearchController(){
        //旧バージョンとの互換性
        setUseStatus(false);        
    }
    
    @Override
    protected Navigation run() throws Exception {
        RequestMap input = new RequestMap(request);
        String type = (String)input.get("t");
        if("json".equals(type) || "jsonp".equals(type)){
            return super.run();
        }
        
        StringBuilder buf = new StringBuilder();
        buf.append("list.html");
        buf.append("?lat=").append(Utils.fixString(input.get("lat")));
        buf.append("&lng=").append(Utils.fixString(input.get("lng")));
        buf.append("&m=").append(Utils.fixString(input.get("m")));
        buf.append("&n=").append(Utils.fixString(input.get("n")));
        
        return forward(buf.toString());
    }
}
